import { getDetectionInfo, submit } from "@/api/detectionInfo"
export default {
  namespaced: true, // 封闭
  state: {

  },
  mutations: {

  },
  getters: {

  },
  actions: {
    // 获取检测信息列表
    async fetchDetectionInfoList(context, payload) {
      let { searchName, perPage, page } = payload
      try {
        const { data } = await getDetectionInfo(searchName, perPage, page)
        return data
      } catch (err) {
        console.log(err)
      }
    },
    // 提交检测信息
    async submit(context, payload) {
      console.log(payload)
      let {
        sampleName,
        businessId,
        samplePhoto,
        detector,
        testingStandard,
        testItem,
        testResults,
        isQualified
      } = payload
      try {
        const { data } = await submit(
          sampleName,
          businessId,
          samplePhoto,
          detector,
          testingStandard,
          testItem,
          testResults,
          isQualified
        )
        return data
      } catch (err) {
        console.log(err)
      }
    }
  }
}
